home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / postgres / postgre3.z / postgre3 / src / lib / H / access / tupdesc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-27  |  2.2 KB  |  87 lines

  1. /*
  2.  * tupdesc.h --
  3.  *    POSTGRES tuple descriptor definitions.
  4.  */
  5.  
  6. #ifndef    TupDescIncluded        /* Include this file only once */
  7. #define TupDescIncluded    1
  8.  
  9. /*
  10.  * Identification:
  11.  */
  12. #define TUPDESC_H    "$Header: /private/postgres/src/lib/H/access/RCS/tupdesc.h,v 1.14 1992/07/09 03:54:39 hong Exp $"
  13.  
  14. #include "tmp/postgres.h"
  15. #include "access/att.h"
  16. #include "access/attnum.h"
  17.  
  18. typedef struct TupleDescriptorData {
  19.     AttributeTupleForm    data[1];    /* VARIABLE LENGTH ARRAY */
  20. } TupleDescriptorData;
  21.  
  22. typedef TupleDescriptorData    *TupleDescriptor;
  23.  
  24. typedef TupleDescriptorData    TupleDescD;
  25.  
  26. typedef TupleDescD        *TupleDesc;
  27.  
  28. /* special tuple descriptor used in the executor */
  29.  
  30. typedef enum {ATTVAL, ATTTUP} AttributeTag;
  31. typedef struct ExecAttDescData {
  32.         AttributeTag          tag;  /* indicating whether it is single value
  33.                                          or a tuple */
  34.         int                   len;  /* if it is a tuple, number of atts */
  35.         TupleDescriptor       attdesc; /* descriptor of atts: variable len */
  36. } ExecAttDescData;
  37. typedef ExecAttDescData *ExecAttDesc;
  38.  
  39. typedef struct ExecTupDescriptorData {
  40.         ExecAttDesc data[1];            /* variable length array */
  41. } ExecTupDescriptorData;
  42. typedef ExecTupDescriptorData *ExecTupDescriptor;
  43.  
  44. /*
  45.  * TupleDescIsValid --
  46.  *    True iff tuple descriptor is valid.
  47.  */
  48. #define    TupleDescIsValid(desc) PointerIsValid(desc)
  49.  
  50. /*
  51.  * CreateTemplateTupleDesc --
  52.  *    Returns template of a tuple descriptor.
  53.  *
  54.  * Exceptions:
  55.  *    BadArg if numberOfAttributes is non-positive.
  56.  */
  57. extern
  58. TupleDesc
  59. CreateTemplateTupleDesc ARGS((
  60.     AttributeNumber    numberOfAttributes
  61. ));
  62.  
  63. /*
  64.  * TupleDescInitEntry --
  65.  *     Initializes attribute of a (template) tuple descriptor.
  66.  *
  67.  * Exceptions:
  68.  *    BadArg if desc is invalid.
  69.  *    BadArg if attributeNumber is non-positive.
  70.  *    BadArg if typeName is invalid.
  71.  *    BadArg if "entry" is already initialized.
  72.  *
  73.  * returns true if attribute is valid or false if attribute information
  74.  * is empty (this is the case when the type name does not exist)
  75.  */
  76. extern
  77. bool
  78. TupleDescInitEntry ARGS((
  79.     TupleDesc    desc,
  80.     AttributeNumber    attributeNumber,
  81.     Name        attributeName,
  82.     Name        typeName,
  83.     int         attdim
  84. ));
  85.  
  86. #endif    /* !defined(TupDescIncluded) */
  87.